<?php

function makeseolinks($forall = false,&$db){

        #SEO LINKS GENERATION START
        if($forall == false){$wheretitle = "";}else{$wheretitle = "where h_title = ''";}
        $sql = "select * from catalog $wheretitle";
        $alda = $db->getAll($sql);
        if(is_array($alda) && @count($alda) > 0)
        foreach($alda as $k => $v){
        $ht = ereg_replace("[^[:alnum:]]",'-',$v['title']);
        for($zzzz=0;$zzzz<10;$zzzz++){$ht = str_replace('--','-',$ht);}
        #$ht = str2db($ht);
        $db->exec("update catalog set h_title = '".$v['catalog_id'].'-'.$ht."' where catalog_id = '".$v['catalog_id']."'");
        }
        #SEO LINKS GENERATION END

}
?>